package com.example.fourcomponentsdemo.broadcastreceiver;

import android.app.Activity;
import android.content.Intent;
import android.content.IntentFilter;
import android.os.Bundle;

/**
 * Created by tangjiangxu on 10/24/17.
 */

public class BroadcastReceiverActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        IntentFilter filter = new IntentFilter();
        filter.addAction("com.example.fourcomponentsdemo.LAUNCH");
        registerReceiver(new MyReceiver(), filter);


        Intent intent = new Intent();
        intent.setAction("com.example.fourcomponentsdemo.LAUNCH");
        sendBroadcast(intent);
    }
}
